package com.xqpaymall.sso.controller;

import com.alibaba.fastjson.JSONObject;
import com.xqpaymall.common.domain.vo.RegisterVo;
import com.xqpaymall.common.domain.vo.RequestVo;
import com.xqpaymall.common.domain.vo.ResponseVo;
import com.xqpaymall.common.domain.vo.base.BaseResponseVo;
import com.xqpaymall.sso.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ Author     ：marui
 * @ Date       ：Created in 9:55 2019/10/15
 */
@RestController
@RequestMapping("/xqpaymall")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public ResponseVo login(@RequestBody String requestData){
        RequestVo loginDo = JSONObject.parseObject(requestData, RequestVo.class);
        ResponseVo responseVo = userService.login(loginDo);
        return responseVo;
    }

    @PostMapping("/register")
    public BaseResponseVo register(@RequestBody String requestData){
        RegisterVo registerDo = JSONObject.parseObject(requestData, RegisterVo.class);
        BaseResponseVo registerVo = null;
        return registerVo;
    }


}
